<template>
  <div></div>
</template>

<script>
export default {
  name: 'test4',
  data () {
  },
  methods: {
    async loadArticles () {
      try {
        this.$http.get('http://localhost:3000/wen').then((response) => {
          console.log(666)
          console.log(response.data)
          this.articles = response.data
        // console.log(response.data.assets[0].username)
        // console.log(JSON.stringify(response.data))
        }).catch(err => {
          console.log(err)
        })
      } catch (err) {
        console.log(err)
        this.$message.error('加载失败')
      }
    },
    // 分页
    YpageChange (curPage) {
      this.curPage = curPage
      this.loadArticles()
    },
    Yedit (index, row) {
      console.log(row.id)
      const Info = row
      localStorage.setItem('Info', JSON.stringify(Info))
      this.$router.push({
        path: '/fa',
        query: { Info: Info }
      })
    },
    async doDelete (idObj) {
      try {
        console.log('你要删除的数据的id是', idObj.toString())
        const id = idObj.toString()
        this.$http.delete(`http://localhost:3000/wen/${id}`).then((response) => {
          console.log(response.data.wen)
          console.log('66')
          this.loadArticles()
        }).error((err) => {
          console.log(err)
        }
        )
      } catch (err) {
        console.log(err)
        this.$message.error('发布失败')
      }
    }
  }
}
</script>

<style>

</style>
